package org.example.atry.dbutil;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class nbutil {
    private static Connection cn = null;
    public static Connection getCon() {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            cn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/paqu", "root", "1245");
            return cn;
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
    public static void closeConn(){
        try {
            if(cn!=null){
                cn.close();
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }


}
